package br.com.cliquetroca.service;

import java.io.Serializable;
import java.util.List;

import br.com.cliquetroca.dao.GenericDao;
import br.com.cliquetroca.exceptions.ApplicationException;

public class GenericService<T> {
	private GenericDao<T> genericDao;
	
	//@Autowired
	public GenericService(GenericDao<T> genericDao) {
		this.genericDao = genericDao;
	}

	public void delete(T o) throws ApplicationException {
		genericDao.delete(o);
	}

	public T findByPk(Serializable pk) throws ApplicationException {
		return genericDao.findByPk(pk);
	}

	public List<T> list() throws ApplicationException {
		return genericDao.list();
	}

	public Serializable save(T o) throws ApplicationException {
		return genericDao.save(o);
	}
}